<?php



@include_once('connect.php') ;


//接受前端数据

$userphone = $_POST['userphone'];
$userpwd = $_POST['userpwd'];

//返回给前端的数据
$res = [];

//判断是否接受成功
if ($userphone && $userpwd) {
    //更新
    $sql = "update user set user_pwd='$userpwd' where user_phone='$userphone'";

    //执行   受影响的行数
    $rows = mysqli_query($conn,$sql);
    if($rows>0){
        $res['status']=true;
        $res['msg']='修改成功';
    }
    else{
        $res['status']=false;
        $res['msg']='数据库错误';
    }

}
else{
    $res['status']=false;
    $res['msg']='前端数据有误';   
}
echo(json_encode($res));